package demo3;

import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

public class Test {
    public static void main(String[] args) {
        String str = "asdf";
        char[] arr = str.toCharArray();
    }
    public static void main6(String[] args) {
        Set<String> set = new TreeSet<>();
        set.add("she");
        set.add("he");
        set.add("he");
        System.out.println(set);
    }
    public static void main5(String[] args) {
        Map<String,Integer> treeMap = new TreeMap<>();
        treeMap.put("he",3);
        treeMap.put("she",6);
        treeMap.put("it",8);
        treeMap.put(null,1);
        System.out.println(treeMap);
    }
    public static void main4(String[] args) {
        Map<String,Integer> treeMap = new TreeMap<>();
        treeMap.put("he",3);
        treeMap.put("she",6);
        treeMap.put("it",8);
        Set<Map.Entry<String, Integer>> set = treeMap.entrySet();
        for (Map.Entry<String, Integer> entry: set) {
            System.out.print(entry.getKey() + " ");
        }
    }
    public static void main3(String[] args) {
        Map<String,Integer> treeMap = new TreeMap<>();
        treeMap.put("he",3);
        treeMap.put("she",6);
        treeMap.put("it",8);
        Set<String> keySet = treeMap.keySet();
        System.out.println(keySet);
    }
    public static void main2(String[] args) {
        Map<String,Integer> treeMap = new TreeMap<>();
        treeMap.put("he",3);
        Integer val = treeMap.getOrDefault("abc",10);
        System.out.println(val);
    }
    public static void main1(String[] args) {
        Map<String,Integer> treeMap = new TreeMap<>();
        treeMap.put("he",3);
        treeMap.put("she",6);
        treeMap.put("it",8);
        Integer val = treeMap.get("hea");
        System.out.println(val);
    }
}
